projects_data <- c(
  "Perl", "1_perl", "Perforce","GIT",
  "kate", "2_kate", "CSV","GIT",
  "koffice", "3_koffice", "CSV","GIT",
  "nautilus", "4_nautilus", "SVN","GIT",
  "postgresql", "5_postgresql", "SVN","GIT",
  "python", "6_python", "SVN","HG",
  "octave", "7_octave", "SVN","HG",
  "netbeans", "8_netbeans", "CVS","HG")

projects_total = 8

projects <- matrix(projects_data, 
                   nrow   = projects_total, 
                   ncol   = 4,
                   byrow  = TRUE)

project_operations_summary <- matrix(nrow   = projects_total, 
                                     ncol   = 6,
                                     byrow  = TRUE)

for (i in 1:projects_total) {
  
  project_before <- read.csv(file = paste(projects[i,2], "_before.csv", sep = ""),
                             head = TRUE,
                             sep=",")
  
  project_after <- read.csv(file = paste(projects[i,2], "_after.csv", sep = ""),
                             head = TRUE,
                             sep=",")
  
  par(mfrow=c(3,1)) 
  
  boxplot( project_before$ADDITIONS_BEFORE, project_after$ADDITIONS_AFTER,      
           horizontal = TRUE,
           names      = c(projects[i,3],projects[i,4]),
           main       = paste("Files additions - ", projects[i,1], sep = ""),                  
           xlab       = "Number of added files per month")
  
  boxplot( project_before$MODIFICATIONS_BEFORE, project_after$MODIFICATIONS_AFTER,     
           horizontal = TRUE,
           names      = c(projects[i,3],projects[i,4]),
           main       = paste("Files modifications - ", projects[i,1], sep = ""),                  
           xlab       = "Number of modified files per month")
  
  boxplot( project_before$DELETIONS_BEFORE, project_after$DELETIONS_AFTER,     
           horizontal = TRUE,
           names      = c(projects[i,3],projects[i,4]),
           main       = paste("Files deletions - ", projects[i,1], sep = ""),                  
           xlab       = "Number of deleted files per month")
  
  
  
  project_operations_summary[i,1] <- colMeans(matrix(project_before$ADDITIONS_BEFORE))   
  project_operations_summary[i,2] <- colMeans(matrix(project_after$ADDITIONS_AFTER))   
  
  project_operations_summary[i,3] <- colMeans(matrix(project_before$MODIFICATIONS_BEFORE))   
  project_operations_summary[i,4] <- colMeans(matrix(project_after$MODIFICATIONS_AFTER))   
  
  project_operations_summary[i,5] <- colMeans(matrix(project_before$DELETIONS_BEFORE))   
  project_operations_summary[i,6] <- colMeans(matrix(project_after$DELETIONS_AFTER))   
  
  dev.copy(png, paste(projects[i,2], ".png", sep = ""))
  
  dev.off()
  
}

project_operations_summary
